<?php
class Macys_Form_Configuration_UpdateOauthAndUrls extends Zend_Form {

	protected $mcom = array();
	protected $mcom_service = array();

	protected $bcom = array();
	protected $bcom_service = array();

	public function init() {
		$con = Macys_Base_Config::getInstance();
		$keys = $con->getOAuthAndUrlsForDisplay();

		foreach ($keys as $key => $value) {
			if(in_array($key, array('mode','site'))) {
				if('site' == $key) {
				
				$this->addElement('select',$key, array(
												'label' => ucfirst($key),
												'attribs' =>   array('id'=>$key,),
            									'multioptions'   => array(
                             							'' => '',
														'mcom' => 'Macys',                
            											'bcom' => 'Bloomingdales',),
												));
				}
				else {
					if('mode' == $key) {
						$this->addElement('select',$key, array(
												'label' => ucfirst($key),
												'attribs' =>   array('id'=>$key,),
            									'multioptions'   => array(
                             							'' => '',
														'mashery' => 'Mashery',                
            											'services' => 'WSSG',),
												));
					}
				}
			}
			else {
				$names = explode('_', $key);
				if(count($names) == 4) {
					$label = ucfirst($names[0]). " " . ucfirst($names[1]) . " " . ucfirst($names[3]);
				}
				if(count($names) == 3) {
					$label = ucfirst($names[0]). " " . ucfirst($names[1]) . " " . ucfirst($names[2]);
				}
				$this->addElement('text',$key, array(
												'size' => 40,
												'label' => $label  ));
				if($names[0] == Macys_Base_Config::MCOMSITE) {
					$this->mcom[] = $key;
				}
				if($names[0] == Macys_Base_Config::BCOMSITE) {
					$this->bcom[] = $key;

				}
			}
		}

		$this->addElement('submit','submit', array(
						'label' => 'Apply'));



		$this->addDisplayGroups(array(
		
			'top' => array(
			'options'  => array('description' => 'Global Setup'),
			'elements' => array('mode', 'site'),
		),
		
			'left' => array(
			'options'  => array('description' => 'Macys Setup'),
		//'elements' => array('mcom_mashery_catalog'),
			'elements' => $this->mcom,
		),
			
			'right' => array(
			'options'  => array('description' => 'Bloomingdales Setup'),
			'elements' => $this->bcom,
		),
			
		
			
			'bottom' => array(
			'elements' => array('submit'),
		),
			
		));

		$this->setDisplayGroupDecorators(array('Description', 'FormElements', 'Fieldset'));
			
	}

}